package com.fieldchain.ex.fa100.utils.chart.auxiliary.axis;

import android.graphics.Color;
import android.util.SparseArray;

import com.github.mikephil.charting.components.XAxis;

/**
 * Created by loro on 2017/2/8.
 */
public class MyXAxis extends XAxis {
    private SparseArray<String> labels;
    private int c1 = Color.parseColor("#FFB7C2CE");
    public SparseArray<String> getXLabels() {
        return labels;
    }
    public void setXLabels(SparseArray<String> labels) {
        this.labels = labels;
    }

    public MyXAxis() {
        //是否启用X轴
        setEnabled(true);
        //是否绘制X轴线
        setDrawAxisLine(false);
        setAvoidFirstLastClipping(true);
        //设置X轴上每个竖线是否显示
        setDrawGridLines(false);
        setDrawAxisLine(false);
        //设置是否绘制X轴上的对应值(标签)
        setDrawLabels(true);
        //设置X轴显示位置
        setPosition(XAxisPosition.BOTTOM);

        //设置竖线为虚线样式
        // enableGridDashedLine(10f, 10f, 0f);
        setTextSize(9);
        setTextColor(c1);
        setGranularity(10f);
        setAvoidFirstLastClipping(true);
    }
}
